<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<script type="text/javascript" src="${base}/scripts/certificate/certificate.js"></script>
<div id="sect_table">
    <div class="searchBar">
        <div class="cnd1-3">
            <span class="label">机构名称</span>

            <div class="inputContainer">
                <input id="js_name" class="inputStyles" data-options="validType:'length[0,32]'"/>
            </div>
        </div>

        <div class="cnd1-3">
            <span class="label">组织机构代码</span>

            <div class="inputContainer">
                <input id="js_code" class="inputStyles"/>
            </div>
        </div>
        <div class="cnd1-3">
            <span class="label">码段</span>

            <div class="inputContainer">
                <input id="js_sn_code" class="inputStyles"/>
            </div>
        </div>
        <div class="cnd1-8">
            <a class="searchButton" onclick="sect_search('${base}/sect')">搜索</a>
        </div>

        <div class="top_fr">
            <a href="#" class="prev prevImg"
               onclick="prevPage($('#top_sect_current_page'),'${base}/sect',2,$('#sect_table'),${obj.sectPage},${obj.qReturn.pageSum})"></a>
            <input id="top_sect_current_page" class="centerInput" value="${obj.sectPage}"/>/
            <input id="top_count_page" readonly="readonly" class="centerInput" value="${obj.qReturn.pageSum}"/>
            <a href="#" class="next nextImg"
               onclick="nextPage($('#top_sect_current_page'),'${base}/sect',2,$('#sect_table'),${obj.sectPage},${obj.qReturn.pageSum})"></a>
        </div>
    </div>

    <div>
        <c:if test="${obj.isAdmin == true}">
            <table class="new_datagrid" id="sect_dg" style="width:100%; height:auto;">
                <thead>
                <tr>
                    <th width="10%">码段</th>
                    <th width="10%">机构名称</th>
                    <th width="10%">组织机构代码</th>
                    <th width="10%">有效期</th>
                    <th width="5%">状态</th>
                    <th width="15%">
                        <a class="new_btn new_btn_back" onclick="create('${base}/sect')">新增</a>
                        <a class="new_btn new_btn_back" style="visibility: hidden"
                           onclick="create('${base}/sect')">新增</a>
                    </th>
                    <th width="5%"></th>
                    <th width="25%"></th>

                </tr>
                </thead>
                <tbody>
                <c:forEach var="sect" items="${obj.qReturn.rows}" varStatus="index">
                    <tr>
                        <td>${sect.name}</td>
                        <td>${sect.orgName}</td>
                        <td>${sect.orgCode}</td>
                        <td>${sect.validDate}</td>
                        <td>${sect.stateName}</td>
                        <c:if test="${sect.state !=1}">
                            <td>
                                <a class="new_btn start_btn_back"
                                   onclick="modifyState('${base}/sect',${sect.id},${sect.state})">启用</a>
                                <a class="new_btn delay_btn_back" onclick="deferred('${base}/sect',${sect.id})">延期</a>
                            </td>
                        </c:if>
                        <c:if test="${sect.state ==1}">
                            <td>
                                <a class="new_btn stop_btn_back"
                                   onclick="modifyState('${base}/sect',${sect.id},${sect.state})">停用</a>
                                <a class="new_btn delay_btn_back" onclick="deferred('${base}/sect',${sect.id})">延期</a>
                            </td>
                        </c:if>
                        <td>
                            <a class="delImg" onclick="delSect('${base}/sect',${sect.id})"></a>
                        </td>
                        <td></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </c:if>
        <%--证书管理表格--%>
        <c:if test="${obj.isAdmin == false}">
            <table class="new_datagrid" id="sect_dg" style="width:100%; height:auto;">
                <thead>
                <tr>
                    <th width="10%">码段</th>
                    <th width="10%">机构名称</th>
                    <th width="10%">组织机构代码</th>
                    <th width="10%">来源</th>
                    <th width="10%">跳转</th>
                    <th width="5%">有效期</th>
                    <th width="5%">状态</th>
                    <th width="35%"></th>
                    <%--<th width="5%"></th>--%>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="sect" items="${obj.qReturn.rows}" varStatus="index">
                    <tr>
                        <td>${sect.name}</td>
                        <td>${sect.orgName}</td>
                        <td>${sect.orgCode}</td>
                        <td>${sect.source}</td>
                        <td>${sect.skipPath}</td>
                        <td>${sect.validDate}</td>
                        <td>${sect.stateName}</td>
                        <td>
                            <a class="new_btn edit_btn_back" onclick="localModify(${sect.id})">编辑</a>
                            <a class="new_btn new_btn_back" onclick="getApply(${sect.id}, '${sect.name}', ${sect.state})">申请证书</a>
                            <a class="new_btn start_btn_back" onclick="getCertificate(${sect.id})">证书日志</a>
                        </td>
                        <%--<td></td>--%>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </c:if>
        <div class="fr">
            <a href="#" class="prev prevImg"
               onclick="prevPage($('#sect_current_page'),'${base}/sect',2,$('#sect_table'),${obj.sectPage},${obj.qReturn.pageSum})"></a>
            <input id="sect_current_page" class="centerInput" value="${obj.sectPage}"/>/
            <input id="count_page" readonly="readonly" class="centerInput" value="${obj.qReturn.pageSum}"/>
            <a href="#" class="next nextImg"
               onclick="nextPage($('#sect_current_page'),'${base}/sect',2,$('#sect_table'),${obj.sectPage},${obj.qReturn.pageSum})"></a>
        </div>
    </div>
</div>


